checks = [
  '001.preprocess',
  '002.debugging_',
  '003.command_li',
  '004.command_li',
  '005.command_li',
  '006.command_li',
  '007.command_li',
  '008.comments',
  '009.comments',
  '010.input_proc',
  '011.input_proc',
  '012.inhibiting',
  '013.inhibiting',
  '014.inhibiting',
  '015.inhibiting',
  '016.inhibiting',
  '017.inhibiting',
  '018.inhibiting',
  '019.inhibiting',
  '020.macro_argu',
  '021.macro_argu',
  '022.macro_argu',
  '023.macro_argu',
  '024.macro_argu',
  '025.quoting_ar',
  '026.macro_expa',
  '027.macro_expa',
  '028.define',
  '029.define',
  '030.define',
  '031.arguments',
  '032.arguments',
  '033.arguments',
  '034.arguments',
  '035.arguments',
  '036.arguments',
  '037.pseudo_arg',
  '038.pseudo_arg',
  '039.pseudo_arg',
  '040.pseudo_arg',
  '041.pseudo_arg',
  '042.pseudo_arg',
  '043.pseudo_arg',
  '044.pseudo_arg',
  '045.pseudo_arg',
  '046.undefine',
  '047.undefine',
  '048.defn',
  '049.defn',
  '050.defn',
  '051.defn',
  '052.defn',
  '053.defn',
  '054.defn',
  '055.pushdef',
  '056.pushdef',
  '057.indir',
  '058.indir',
  '059.indir',
  '060.builtin',
  '061.builtin',
  '062.builtin',
  '063.builtin',
  '064.builtin',
  '065.ifdef',
  '066.ifelse',
  '067.ifelse',
  '068.ifelse',
  '069.ifelse',
  '070.ifelse',
  '071.shift',
  '072.shift',
  '073.shift',
  '074.shift',
  '075.shift',
  '076.shift',
  '077.shift',
  '078.shift',
  '079.forloop',
  '080.forloop',
  '081.forloop',
  '082.foreach',
  '083.foreach',
  '084.foreach',
  '085.foreach',
  '086.foreach',
  '087.foreach',
  '088.stacks',
  '089.stacks',
  '090.compositio',
  '091.compositio',
  '092.compositio',
  '093.compositio',
  '094.dumpdef',
  '095.dumpdef',
  '096.trace',
  '097.trace',
  '098.trace',
  '099.trace',
  '100.trace',
  '101.debug_leve',
  '102.debug_leve',
  '103.debug_leve',
  '104.debug_outp',
  '105.dnl',
  '106.dnl',
  '107.dnl',
  '108.changequot',
  '109.changequot',
  '110.changequot',
  '111.changequot',
  '112.changequot',
  '113.changequot',
  '114.changequot',
  '115.changequot',
  '116.changequot',
  '117.changequot',
  '118.changequot',
  '119.changecom',
  '120.changecom',
  '121.changecom',
  '122.changecom',
  '123.changecom',
  '124.changecom',
  '125.changeword',
  '126.changeword',
  '127.changeword',
  '128.changeword',
  '129.changeword',
  '130.changeword',
  '131.m4wrap',
  '132.m4wrap',
  '133.m4wrap',
  '134.m4wrap',
  '135.m4wrap',
  '136.m4wrap',
  '137.include',
  '138.include',
  '139.include',
  '140.include',
  '141.include',
  '142.include',
  '143.diversions',
  '144.diversions',
  '145.diversions',
  '147.divert',
  '148.divert',
  '149.divert',
  '150.divert',
  '151.divert',
  '152.undivert',
  '153.undivert',
  '154.undivert',
  '155.undivert',
  '156.undivert',
  '157.undivert',
  '158.divnum',
  '159.cleardiver',
  '160.cleardiver',
  '161.len',
  '162.index_macr',
  '163.index_macr',
  '164.index_macr',
  '165.index_macr',
  '166.regexp',
  '167.regexp',
  '168.regexp',
  '169.substr',
  '170.substr',
  '171.translit',
  '172.translit',
  '173.translit',
  '174.translit',
  '175.patsubst',
  '176.patsubst',
  '177.patsubst',
  '178.patsubst',
  '179.patsubst',
  '180.format',
  '181.format',
  '182.format',
  '183.format',
  '184.incr',
  '185.eval',
  '186.eval',
  '187.eval',
  '188.eval',
  '189.eval',
  '190.eval',
  '191.platform_m',
  '192.platform_m',
  '193.platform_m',
  '202.errprint',
  '203.location',
  '204.location',
  '205.location',
  '206.m4exit',
  '207.m4exit',
  '208.using_froz',
  '209.using_froz',
  '210.using_froz',
  '211.extensions',
  '212.other_inco',
  '213.other_inco',
  '214.improved_e',
  '215.improved_f',
  '216.improved_f',
  '217.improved_f',
  '218.improved_f',
  '219.improved_f',
  '220.improved_f',
  '221.improved_f',
  '222.improved_f',
  '223.improved_f',
  '224.improved_f',
  '225.improved_f',
  '226.improved_f',
  '227.improved_f',
  '228.improved_f',
  '229.improved_c',
  '230.improved_c',
  '231.improved_m',
  '232.improved_m',
  '233.improved_c',
  '234.improved_c',
  '235.improved_c',
  '236.improved_f',
  '146.diversions',
]

noparallel_checks = [
  # This is doing an rm *, and the glob sometimes captures other test's temp
  # directories
  '199.mkstemp',  # Wants rm
]

nowindows_checks = [
  '194.syscmd',  # Wants echo
  '195.syscmd',  # Wants cat
  '196.esyscmd',  # Wants echo
  '197.sysval',  # Wants false
  '200.mkstemp',  # Wants rm
  '201.mkstemp',  # Wants rm
]

no_checks = [
  # This test depends on /bin/sh being bash. Rather than trying to identify
  # dash, just skip the test. If you are very interested in m4, you can enable
  # this manually.
  '198.sysval',
]

py = find_program('python3')
m4_test = files('m4_test_runner.py')
m4_env = [
  'TMPDIR=' + meson.project_build_root(),
  'M4PATH=' + meson.project_source_root() / 'examples',
]
m4_path = m4.full_path()

foreach file : checks
  test(
    file,
    py,
    args: [
      m4_test,
      m4_path,
      files(file),
      meson.current_build_dir(),
      meson.project_source_root(),
    ],
    env: m4_env,
    depends: m4,
  )
endforeach

if host_machine.system() != 'windows'
  foreach file : noparallel_checks
    test(
      file,
      py,
      args: [
        m4_test,
        m4_path,
        files(file),
        meson.current_build_dir(),
        meson.project_source_root(),
      ],
      depends: m4,
      env: m4_env,
      is_parallel: false,
    )
  endforeach

  foreach file : nowindows_checks
    test(
      file,
      py,
      args: [
        m4_test,
        m4_path,
        files(file),
        meson.current_build_dir(),
        meson.project_source_root(),
      ],
      env: m4_env,
      depends: m4,
    )
  endforeach
endif
